package system_design.home.jiekou;

import system_design.home.shiti.Goods;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: LENOVO
 * Date: 2022-01-07
 * Time: 10:16
 */
public class FindOperation implements IOperation{
    public void work(GoodsList goodsList) {
        System.out.println("查找商品");
        String name = input.nextLine();
        int size = goodsList.getUsedSize();
        for (int i = 0; i < size; i++) {
            Goods goods = goodsList.getGoods(i);
            if(name.equals(goods.getGoodsName())){
                System.out.println("找到此商品，信息如下：");
                System.out.println(goods);
                return;
            }
        }
        System.out.println("未找到该商品");
    }
}
